home *** CD-ROM | disk | FTP | other *** search
- /* info_about class */
- class info_about {
-
- /* personable info */
- String name;
- int age;
- int height;
- int weight;
-
- /* constructor to set the name */
- /* weÆll assume other stats get set elsewhere/later */
- public info_about(String S) { name = S; }
-
- /* hashCode method returns the first character */
- public int hashCode() {
- return (int)name.charAt(0);
- }
-
- /* equals methods checks for match on first three characters */
- public boolean equals(Object compare) {
- info_about temp = (info_about)compare;
-
- /* check for first three letter match */
- for (int g=0;g<3;++g) {
- if (this.name.charAt(g) != temp.name.charAt(g))
- return false;
- }
-
- /* all matched, return true */
- return true;
- }
- }
-
-